package com.biostime.dingdingbox.modules.db.service;

import java.util.Date;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Service;
import com.biostime.dingdingbox.modules.db.entity.ReadHistory;
import org.springframework.transaction.annotation.Transactional;

import com.biostime.dingdingbox.common.service.CrudService;
import com.biostime.dingdingbox.modules.db.dao.ReadHistoryDao;

/**
 * 访问记录表Service
 * @author chenweicheng
 * @version 2016-07-03
 */
@Service
@Transactional
public class ReadHistoryService extends CrudService<ReadHistoryDao, ReadHistory> {
		
	public void insert(HttpServletRequest request,String type,String objectId , String userId){
		ReadHistory history = new ReadHistory();
		history.setCreateDate(new Date());
		history.setIpAddress(HttpRequestService.getIpAddress(request));  
		history.setMemberId(Integer.parseInt(userId));
		history.setObjectId(Integer.parseInt(objectId));
		history.setType(type); 
		save(history);
	}
	
}
